-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(multichain): fusdc "advance and settle" as a macro #10692
Conversation
@@ -34,7 +34,7 @@ const accounts = [...keys(oracleMnemonics), 'lp']; | |||
const contractName = 'fastUsdc'; | |||
const contractBuilder = | |||
'../packages/builders/scripts/fast-usdc/init-fast-usdc.js'; | |||
const LP_DEPOSIT_AMOUNT = 10_000_000n; | |||
const LP_DEPOSIT_AMOUNT = 8_000n * 10n ** 6n; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have the 10^6 as a constant somewhere but this is clear enough. better than the literal
'published.agoricNames.instance', | ||
); | ||
const instance = fromEntries(instances)[contractName]; | ||
// TODO export/import INVITATION_MAKERS_DESC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should not be imported. the test should be declaring what it expects the value to be, not just that it matches something else.
consider if someone changed the value in the other module. the test should fail and have to be updated to make clear that the API changed.
); | ||
const instance = fromEntries(instances)[contractName]; | ||
// TODO export/import INVITATION_MAKERS_DESC | ||
const ORACLE_INV_DESC = 'oracle operator invitation'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the reason above I think this shouldn't have ALL_CAPS casing. defining the value at all is just a convenience in this function to not have to repeat it.
```suggestion
const description = 'oracle operator invitation';
0daf237
to
0cdb981
Compare
57494a3
to
4a1e603
Compare
Deploying agoric-sdk with Cloudflare Pages
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to talk over a suggestion to factor out roles / participants with makeOracleOperator(...)
and such.
const hasInvitation = invitations.some( | ||
x => x.description === ORACLE_INV_DESC, | ||
); | ||
const usedInvitation = offerToUsedInvitation?.[0]?.[0] === `${name}-accept`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const usedInvitation = offerToUsedInvitation?.[0]?.[0] === `${name}-accept`; | |
const usedInvitation = offerToUsedInvitation.some(([id, _v]) => id === `${name}-accept`); |
|
||
// ensure we have an unused (or used) oracle invitation in each purse | ||
let hasAccepted = false; | ||
for (const name of keys(oracleMnemonics)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot going on in this loop.
If we reify the oracle operators as objects somewhat like makeOracleOperator or makeAgoricWatcher, we can make this read much more straightforwardly:
for (const name of keys(oracleMnemonics)) { | |
for (const op of oracleOperators) { | |
const status = await oracle.invitationCheck(); // returns the invitation or `used` if used; | |
t.log({ name: op.name, status }); | |
t.truthy(status); | |
} |
t.true(hasInvitation || usedInvitation, 'has or accepted invitation'); | ||
if (usedInvitation) hasAccepted = true; | ||
} | ||
// if the oracles have already accepted, skip the rest of the test this is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// if the oracles have already accepted, skip the rest of the test this is | |
// if any of the oracles have already accepted, skip the rest of the test this is |
right?
); | ||
t.log('settlementAccount address', settlementAccount); | ||
const advanceAndSettleScenario = test.macro({ | ||
title: (_, mintAmt: bigint, eudChain: string) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
eudChain
is kinda... tortured
title: (_, mintAmt: bigint, eudChain: string) => | |
title: (_, mintAmt: bigint, destChain: string) => |
} = t.context; | ||
|
||
// EUD wallet on the specified chain | ||
const eudWallet = await createWallet( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likewise...
const eudWallet = await createWallet( | |
const destWallet = await createWallet( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather avoid using the ambient random source inside createWallet
. I don't suppose we have a widget where you pass crypto.randomBytes(plenty)
and it makes a mnemonic, do we? Or can we pass in a private key?
I can imagine this isn't worthwhile just now, so... adding it to the list:
aux: { | ||
forwardingChannel: nobleAgoricChannelId, | ||
// register forwarding address on noble | ||
const txRes = nobleTools.registerForwardingAcct( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, lots going on; my tiny brain wants the roles (user, noble chain, ...) reified as objects.
|
||
// submit evidences | ||
await Promise.all( | ||
oracleWds.map(makeDoOffer).map((doOffer, i) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would love to see...
oracleWds.map(makeDoOffer).map((doOffer, i) => | |
oracleOperators.map(op => op.submit(evidence)); |
Base branch is changed to master. Please re-run the integration tests by adding 'force:integration' label. |
const { offerToUsedInvitation, purses } = await vstorageClient.queryData( | ||
`published.wallet.${wallets[name]}.current`, | ||
); | ||
const { value: invitations } = balancesFromPurses(purses)[Invitation]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that work?
balancesFromPurses
returns a map, right? and Invitation
is a Brand
operators.map(async op => { | ||
const { invitation, usedInvitation } = await op.checkInvitation(); | ||
t.log({ name: op.getName(), invitation, usedInvitation }); | ||
t.true(invitation || usedInvitation, 'has or accepted invitation'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this map
function return usedInvitation
for the logic below to work? If it doesn't return anything then checks.some(Boolean)
would always be false right?
3ee3fbe
to
6134570
Compare
44f280c
to
e084cac
Compare
e084cac
to
4a1e603
Compare
I haven't gotten set up to test this locally; using ci to test it is pretty slow. Let's roll back to before @0xpatrickdev handed this to me and see if it's green. If so, I can do my refactor in a follow-on. |
No quorum: flake in z:acceptance governance?
Mon, 16 Dec 2024 04:10:39 GMT |
- include `agoric` and `noble` EUD destinations
- mainly to facilitate active development; allows test to be run more than once
295e818
to
4ce1540
Compare
This pull request has been removed from the queue for the following reason: The merge conditions cannot be satisfied due to failing checks: You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. If you want to requeue this pull request, you need to post a comment with the text: |
psm acceptance flake?in https://github.com/Agoric/agoric-sdk/actions/runs/12363738833/job/34505666038?pr=10692#step:10:8349 |
refs: #10597
Description
Security Considerations
None, only tests
Scaling Considerations
None, ~60s hit to CI (each advance + settle is about 30s)
Documentation Considerations
None
Testing Considerations
PR is only tests
Upgrade Considerations
None